<template>
    <div class="body">
    <!-- 头部图片 -->
    <div class="header">
      <img
        src="../../assets/img/gouwukatou@2x.png"
        alt=""
      >
    </div>
    <img
      class="brn"
      src="../../assets/img/t1.png"
      alt=""
    >
    <div class="muche">
      <!-- 轮播two -->
      <!-- :autoplay="2000" -->
      <van-swipe
        :duration="700"
        :autoplay="3000"
        style="height:7.226667rem;"
        :show-indicators=false
      >
        <van-swipe-item
          v-for="item in listerd"
          :key="item.goods_id"
        >
          <ul>
            <li
              v-for="itemr in item"
              :key="itemr.goods_id"
              @click="nav(itemr)"
            >
              <div class="back">
                <img
                  class="one-hit"
                  :src="itemr.goods_img"
                  alt=""
                >
              </div>

              <div class="text-one"> {{itemr.goods_name}}</div>
              <div class="money-Hot">¥ {{itemr.active_price}}</div>
              <div class="Go-hot">立即抢购</div>
            </li>
          </ul>
        </van-swipe-item>
      </van-swipe>
    </div>

    <div class="super">
      <img
        src="../../assets/img/chaozhi1@2x(1).png"
        alt=""
      >
    </div>
    <!-- 超值专项 -->
    <div class="box">
      <span class="textone">媛福达商城专享购物卡 最高享
        <span class="zhekou">8</span>折</span>
      <div class="texter">（购买完成后会自动充值到我余额中）</div>
      <div>

        <ul>
          <li @click="nav({goods_id:7704})">
            <img
              src="../../assets/img/110.png"
              alt=""
            >
          </li>
          <li @click="nav({goods_id:7708})">
            <img
              src="../../assets/img/230.png"
              alt=""
            >
          </li>
          <li @click="nav({goods_id:7711})">
            <img
              src="../../assets/img/590.png"
              alt=""
            >
          </li>
          <li @click="nav({goods_id:7714})">
            <img
              src="../../assets/img/1000.png"
              alt=""
            >
          </li>
        </ul>
      </div>
    </div>
    <!-- 购物卡专享 -->
    <div class="goshooping">
      <img
        src="../../assets/img/chaozhi2@2x.png"
        alt=""
      >
    </div>
    <!-- 购物专项 -->
    <div class="gouwuka">
      <ul>
        <li
          v-for="item in list"
          :key="item.goods_id"
          @click="nav(item)"
        >
          <img
            :src="item.goods_img"
            alt=""
            class="imagesa"
          >
          <div class="textshang">{{item.goods_name}}</div>
          <div class="much">
            <span class="renming">¥</span>
            {{item.active_price}}
          </div>
        </li>
      </ul>
    </div>
    <div class="gouwuka1">
      <ul>
        <li
          v-for="item in lister"
          :key="item.goods_id"
          @click="nav(item)"
        >
          <img
            :src="item.goods_img"
            alt=""
            class="imagesa"
          >
          <div class="textshang">{{item.goods_name}}</div>
          <div class="much">
            <span class="renming">¥</span>
            {{item.active_price}}
          </div>
        </li>
      </ul>
    </div>
    <!-- 弹出 -->
    <!-- <van-popup v-model="shower">
      <div class="choice">
        <div class="h3">温馨提示</div>
        <div class="text">
          未参与
          <span>618</span>
          购卡加赠品，请点击“满送加赠品”，如已参加请点击“续购”
        </div>
        <div
          class="dev"
          @click="one"
        >
          满送加赠品
        </div>
        <div
          class="dever"
          @click="two"
        >
          续购
        </div>
      </div>
    </van-popup> -->
  </div>
</template>

<script>
import { index } from '@/api/index'
import { getSystem, openApp, getUrlQuery } from '../../js/js'
export default {
  // 组件名称
  name: '',
  // 局部注册的组件
  components: {},
  // 组件参数 接收来自父组件的数据
  props: {},
  // 组件状态值
  data () {
    return {
      list: {},
      lister: {},
      listerd: {},
      system: getSystem(),
      show: false,
      shower: false,
      id: '',
    }
  },
  // 计算属性
  computed: {},
  // 侦听器
  watch: {},
  // 生命周期钩子   注：没用到的钩子请自行删除
  /**
  * 组件实例创建完成，属性已绑定，但DOM还未生成，$ el属性还不存在
  */
  created () {
    window.scrollTo(0, 0)
    this.create()
    // this.weixin()
  },
  /**
  * el 被新创建的 vm.el 替换，并挂载到实例上去之后调用该钩子。
  * 如果 root 实例挂载了一个文档内元素，当 mounted 被调用时 vm.el 也在文档内。
  */
  mounted () { },
  // 组件方法
  methods: {
    async create () {
      try {
        const res = await index({
          id: 4
        })
        console.log(res);
        this.list = res.data.data.types[0].goods
        this.lister = res.data.data.types[1].goods

        var atrdev = res.data.data.types[2].goods

        var resultdev = []
        for (var i = 0; i < atrdev.length; i += 2) {
          resultdev.push(atrdev.slice(i, i + 2));
        }
        this.listerd = resultdev
        console.log(this.listerd);
      } catch (err) {
        console.log('错误');
      }
    },
    // 跳转下载
    nav (item) {
      console.log(item.goods_id);
      window.location.href = 'yfd://yfdmall:8080/goodsDetail?spuId=' + item.goods_id
    },
    href (uri, blank = true) {
      const a = document.createElement('a')
      a.style.display = 'none'
      a.href = uri
      if (blank) a.setAttribute('target', '_blank')
      document.body.appendChild(a)
      a.click()
      setTimeout(t => {
        document.body.removeChild(a)
      }, 0)
    },
  }
}
</script>

<style scoped lang="less">
.body {
  overflow: hidden;
  /* overflow-y: scroll; */
  height: 100%;
  min-width: 320px;
  max-width: 750px;
  width: 10rem;
  margin: 0 auto;
  line-height: 1.5;
  font-family: Arial, Helvetica;
  background: #3e3b46;
}
.van-popup {
  width: 7.866667rem;
  height: 4.88rem;
  border-radius: 0.266667rem;
  background: #ffffff;
}
.muche {
  width: 10rem;
  height: 8.52rem;
  margin: 0 auto 0.4rem;
  border-radius: 0.266667rem;
  box-sizing: border-box;
  background: #1d1b22;
  overflow: hidden;
  padding-top: 0.666667rem;
  .van-swipe {
    width: 10rem;
    // margin-left: 0.14rem;
  }
  /deep/ .van-swipe-item {
    ul li {
      float: left;
      position: relative;
      width: 4.613333rem;
      margin-left: 0.2653333rem;
      margin-bottom: 0.16rem;
      height: 7.226667rem;
      border-radius: 0.266667rem;
      background-color: #ffffff;
      .back {
        width: 100%;
        height: 4.56rem;
        background-color: #f8f8f7;
        border-radius: 0.266667rem;
        .one-hit {
          width: 4.053333rem;
          height: 3.693333rem;
          margin-top: 0.466667rem;
          margin-left: 0.32rem;
        }
      }
      .text-one {
        width: 4.04rem;
        height: 1.093333rem;
        font-size: 0.373333rem;
        color: #193164;
        margin: 0 auto;
        // font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
      }
      .money-Hot {
        // width: 1.733333rem;
        height: 0.533333rem;
        font-size: 0.426667rem;
        margin-left: 0.32rem;
        margin-top: 0.08rem;
        font-weight: 600;
        color: red;
      }
      .Go-hot {
        // position: absolute;
        // right: 10%;
        // bottom: 3%;
        width: 4.106667rem;
        height: 0.72rem;
        margin: 0 auto;
        font-size: 0.426667rem;
        text-align: center;
        line-height: 0.72rem;
        color: #ffffff;
        border-radius: 0.1rem;
        // border: 0.013333rem solid #6d240b;
        background: #c93b2c;
      }
    }
  }
}
.choice {
  width: 7.866667rem;
  height: 4.88rem;
  border-radius: 0.266667rem;
  background: #ffffff;
  position: relative;
  .h3 {
    width: 1.866667rem;
    height: 0.453333rem;
    font-size: 0.453333rem;
    color: #1e2022;
    font-weight: 600;
    margin: 0.466667rem auto;
  }
  .text {
    width: 6.533333rem;
    height: 1.946667rem;
    margin: 0 auto;
    line-height: 0.64rem;
    font-size: 0.426667rem;
    color: #606060;
    text-align: center;
    span {
      display: inline-block;
      width: 0.953333rem;
      line-height: 0.453rem;
      height: 0.453333rem;
      text-align: center;
      color: #ffffff;
      background: #f80464;
      border-radius: 0.133333rem;
    }
  }
  .dev {
    position: absolute;
    bottom: 14%;
    left: 6%;
    width: 3.12rem;
    height: 1.066667rem;
    background: #f80464;
    color: #ffffff;
    text-align: center;
    line-height: 1.06rem;
    font-size: 0.426667rem;
    border-radius: 0.496667rem;
  }
  .dever {
    position: absolute;
    bottom: 14%;
    right: 6%;
    width: 3.12rem;
    height: 1.066667rem;
    background: #ffffff;
    border: 0.026667rem solid #979797;
    color: #515151;
    text-align: center;
    line-height: 1.06rem;
    font-size: 0.426667rem;
    border-radius: 0.496667rem;
  }
}
.texter {
  width: 5.6rem;
  margin-left: 0.296667rem;
  font-size: 0.32rem;
  color: #ffedcd;
}
.header {
  position: relative;
  width: 10rem;
  height: 11.546667rem;
}
.header img {
  width: 100%;
  height: 100%;
}
.header .super {
  /* border-top: 1px dashed #fff;
  border-bottom: 1px dashed #fff; */
  position: absolute;
  bottom: 1.6rem;
  height: 0.48rem;
}
.super img {
  margin-bottom: 0.266667rem;
}
.brn {
  margin: 0 auto 0.4rem;
}
.box {
  width: 9.626667rem;
  // height: 11.093333rem;
  overflow: hidden;
  background-color: #1d1b22;
  margin: 0 0.226667rem;
  border-radius: 0.133333rem;
}
.box .textone {
  font-family: CN Medium;
  font-size: 0.426667rem;
  color: #ffedcd;
  padding-top: 0.8rem;
  padding-left: 0.586667rem;
}
.textone .zhekou {
  color: #ff2306;
}
.box ul {
  padding: 0;
}
.box ul li {
  list-style: none;
  width: 8.986667rem;
  height: 2.24rem;
  /* border: 1px dashed #fff; */
  border-radius: 0.133333rem;
  margin: 0.48rem 0.373333rem;
}
.goshooping {
  /* border-top: 1px dashed #fff;
  border-bottom: 1px dashed #fff; */
  bottom: 1.6rem;
  height: 0.48rem;
  margin: 0.56rem 0;
}
.goshooping img {
  margin-bottom: 0.266667rem;
}
.gouwuka {
  margin-bottom: 1.066667rem !important;
  width: 9.626667rem;
  height: 14.966667rem;
  background-color: #1d1b22;
  margin: 0 0.226667rem;
  border-radius: 0.133333rem;
}
.gouwuka1 {
  margin-bottom: 1.066667rem !important;
  width: 9.626667rem;
  height: 60.966667rem;
  background-color: #1d1b22;
  margin: 0 0.226667rem;
  border-radius: 0.133333rem;
}
.gouwuka1 ul li {
  position: relative;
  float: left;
  width: 2.986667rem;
  height: 4.053333rem;
  background-color: #ffffff;
  margin-left: 0.15555rem;
  margin-top: 0.533333rem;
  border-radius: 0.133333rem;
}
.gouwuka ul li {
  position: relative;
  float: left;
  width: 2.986667rem;
  height: 4.053333rem;
  background-color: #ffffff;
  margin-left: 0.15555rem;
  margin-top: 0.533333rem;
  border-radius: 0.133333rem;
}
/* .gouwuka ul li:nth-of-type(n + 7) {
  margin-top: 1.066667rem;
} */
.imagesa {
  width: 2.4rem;
  height: 2.4rem;
  padding: 0.2rem 0.266667rem;
}
.textshang {
  padding-left: 0.213333rem;
  position: absolute;
  width: 100%;
  bottom: 0.933333rem;
  font-size: 0.373333rem;
  color: #000000;
  font-family: 思源黑体 CN Normal;
  /* font-weight: 600; */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.much .renming {
  padding-left: 0.266667rem;
  color: red;
  font-size: 0.45rem;
  /* font-weight: 600; */
}
.much {
  color: red;
  font-size: 0.533333rem;
}
/* .rigth {
  position: absolute;
  top: 0;
  width: 10rem;
  height: 20rem;
  background-color: #1e1e1e;
  opacity: 0.8;
}
.rigth img {
  width: 8rem;
  height: 4.4rem;
  float: right;
} */
@keyframes mymove {
  0% {
    transform: scale(1); /*开始为原始大小*/
  }
  25% {
    transform: scale(1.1); /*放大1.1倍*/
  }
  50% {
    transform: scale(1);
  }
  75% {
    transform: scale(1.1);
  }
}
@-webkit-keyframes mymove /*Safari and Chrome*/ {
  0% {
    transform: scale(1); /*开始为原始大小*/
  }
  25% {
    transform: scale(1.1); /*放大1.1倍*/
  }
  50% {
    transform: scale(1);
  }
  75% {
    transform: scale(1.1);
  }
}
</style>
